<template>
  <el-dialog
    title="设置"
    :visible.sync="$attrs.visableIf"
    @close="handleCloseDialog"
    width="600px"
    append-to-body
    class="borderb_dia"
  >
    <el-form
      ref="form"
      :model="form"
      :rules="rules"
      label-width="150px"
      label-position="left"
    >
      <el-form-item label="多企微号客户去重" prop="name">
        <div class="item-big">
<!--          <div style="display: flex; height: 50px; align-items: center">-->
            <el-switch
              v-model="form.open">
            </el-switch>
<!--          </div>-->
          <div class="tips">
            <p>
              1. 选择多个企微号创建任务时，会进行客户去重，即，多个号上的重复客户将随机选择其中一个号对其展示该条朋友圈；
            </p>
          <p>
            2. 选择“全部客户”进行发表，最终触达的是任务创建那一刻的全部客户，任务创建后到朋友圈发表前添加的新客户看不到该条朋友圈（在企微APP上自己看该条朋友圈的可见范围为部分可见）。
          </p>
          </div>

        </div>

      </el-form-item>
    </el-form>
    <div slot="footer" class="footer-btn">
      <el-button @click="handleCloseDialog">取消</el-button>
      <el-button type="primary" @click="submitForm">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
// import { validPhone, validPassword } from "@/utils/validate";
// import { editInfo } from "@/api/advmaster";
export default {
  data() {
    return {
      form: {
        id: "",
        name: "",
        phone: "",
        email: "",
        status: "",
        password: "",
        type_id:[],
      },
      typeList:[
        {
          value:1,
          label:'自动删除最后触发时间最早的',
        },
        {
          value:1,
          label:'自动删除添加时间最早的',
        }
      ],
      WxTtypeList:[
        {
          value:1,
          label:'个人微信',
        },
        {
          value:1,
          label:'企业微信',
        }
      ],
      // 表单校验
      rules: {
        name: [{ required: true, message: "请输入用户名", trigger: "blur" }],
        email: [
          {
            required: true,
            type: "email",
            message: "请输入正确的邮箱地址",
            trigger: "blur",
          },
        ],
        password: [
        ],
        status: [{ required: true, message: "请选择状态", trigger: "change" }],
      },
    };
  },
  props: {
    rowitem: {
      default: null,
    },
  },
  created() {
    this.form.id = this.rowitem.custom.id;
    this.form.name = this.rowitem.custom.user_login;
    this.form.phone = this.rowitem.custom.mobile;
    this.form.email = this.rowitem.custom.email;
    this.form.password = this.rowitem.custom.password;
    this.form.status = this.rowitem.custom.status;
  },
  methods: {
    //重置表单
    handleReset() {
      this.resetForm("form");
    },

    handleCloseDialog() {
      this.$emit("update:visableIf", false);
    },

    submitForm: function() {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          if (this.form.id != undefined) {
            // editInfo(this.form).then(() => {
            //   this.$modal.msgSuccess('修改成功')
            //   this.handleCloseDialog();
            //   this.$emit('getList');
            // })
          }
        }
      })
    },
  },
};
</script>

<style scoped lang="scss">
.operate-Big {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
}

.group-right {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 15px;
}
.item-big {
  display: flex;
  flex-direction: column;
  padding-top: 8px;
  .tips {
    font-size: 14px;
    line-height: 20px;
    color: rgba(0, 0, 0, .45);

  }
}
.el-radio-group {
  padding-top: 10px;
  .el-radio {
    margin-bottom: 5px;
  }
}
</style>
